<?php

namespace app\ru\controller;

use app\common\controller\Frontend;
use think\Db;
class Index extends Frontend
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function _initialize()
    {
        parent::_initialize();
    }


    public function index()
    {
       //banner
        $section['banner'] = Db::name('bannerlist')->where('status',1)->order('weigh','desc')->select();
        //简介
        $section['jianjie'] = Db::name('danye')->where('id',1)->find();
        //广告
        $section['img1'] = Db::name('danye')->where('id',2)->find();

        //推荐产品分类 和 列表
        $section['protype'] = Db::name('productstype')->where('status',7)->where('switch',1)->order('weigh','desc')->limit(3)->select();
        foreach ($section['protype'] as $key => $value) {
            $section['protype'][$key]['list'] = Db::name('productslist')->where('tuiswitch',1)->where('productstype',$value['id'])->order('weigh','desc')->limit(4)->select();
        }

        //应用领域
        $section['lingyu'] = Db::name('about')->where('status',6)->order('weigh','desc')->limit(6)->select();

        //底部单页
        $section['idxdibu1'] = Db::name('danye')->where('id',3)->find();
        $section['idxdibu2'] = Db::name('danye')->where('id',4)->find();
        
        $this->view->assign('section', $section);
        $this->view->assign('lanmu', 1);
        return $this->view->fetch();


    }


}
